package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 杜志娟 on 2016-04-27.
 * 衣物分类
 */
public class ClothesCategory extends CustomerSpinnerObject {
    private int id;
    private String clothingcategory;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getClothingcategory() {
        return clothingcategory;
    }

    public void setClothingcategory(String clothingcategory) {
        this.clothingcategory = clothingcategory;
    }
    @Override
    public String toString() {
        return clothingcategory;
    }
    public static List<ClothesCategory> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesCategory> groups = new ArrayList<ClothesCategory>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesCategory clothesCategory = new ClothesCategory();
            clothesCategory.id = (jsonArray.getJSONObject(i)).getInt("id");
            clothesCategory.clothingcategory = (jsonArray.getJSONObject(i)).getString("clothing_category");
            groups.add(clothesCategory);
        }
        return groups;
    }
}
